<?php
//代理模式
interface GiveGift{
    public function GiveDolls();
    public function GiveFlowers();
    public function GiveChocolate();
}

class Pursuit implements GiveGift{
    public $mm;

    public function __construct(SchoolGirl $mm)
    {
        $this->mm = $mm;
    }

    public function GiveDolls()
    {
        echo $this->mm->name.'送你洋娃娃';
    }

    public function GiveFlowers()
    {
        echo $this->mm->name.'送你花';
    }

    public function GiveChocolate()
    {
        echo $this->mm->name.'送你巧克力';
    }
}

class Proxy implements Givegift{
    public $gg;
    public function __construct(SchoolGirl $mm)
    {
        $this->gg = new Pursuit($mm);
    }

    public function GiveDolls()
    {
        echo $this->gg->GiveDolls();
    }

    public function GiveFlowers()
    {
        echo $this->gg->GiveFlowers();
    }

    public function GiveChocolate()
    {
        echo $this->gg->GiveChocolate();
    }
}

class SchoolGirl{
    public $name;
    public function __construct($name)
    {
        $this->name = $name;
    }
}

//客户端实现
$girl = new SchoolGirl('韩梅梅');
$proxy = new Proxy($girl);
$proxy->GiveDolls();
$proxy->GiveFlowers();
$proxy->GiveChocolate();
